home *** CD-ROM | disk | FTP | other *** search
- property cell, adjacentList, cellType, Xloc, Yloc, tileType, tileNum, horizValue, vertValue, startTileNum, startTileType, connector
- global gSimObject
-
- on birth me, cellNum, type, x, y, hVal, vVal
- set cell to cellNum
- set cellType to type
- set startTileNum to 0
- set tileNum to startTileNum
- set startTileType to #BG
- set tileType to startTileType
- set Xloc to x
- set Yloc to y
- set horizValue to hVal
- set vertValue to vVal
- set connector to 0
- initAdjacentList()
- return me
- end
-
- on initAdjacentList me
- set adjacentList to []
- repeat with adjVector in getProp(the adjList of gSimObject, cellType)
- add(adjacentList, adjVector)
- end repeat
- end
-
- on saveCell me
- repeat with propName in [tileType, startTileType]
- set cellData to cellData & string(getPos(the cellTypeList of gSimObject, propName)) & ","
- end repeat
- repeat with propNum in [tileNum, startTileNum]
- set cellData to cellData & string(propNum) & ","
- end repeat
- set cellData to cellData & string(connector) & ","
- set cellData to cellData & string(count(adjacentList)) & ","
- if count(adjacentList) > 0 then
- repeat with adj in adjacentList
- set cellData to cellData & string(getPos(the arrowList of gSimObject, adj)) & ","
- end repeat
- end if
- set cellData to char 1 to length(cellData) - 1 of cellData
- return cellData
- end
-
- on loadCell me
- set tileType to getAt(the cellTypeList of gSimObject, readData(gSimObject))
- set startTileType to getAt(the cellTypeList of gSimObject, readData(gSimObject))
- set tileNum to readData(gSimObject)
- set startTileNum to readData(gSimObject)
- set connector to readData(gSimObject)
- set adjListLength to readData(gSimObject)
- set adjacentList to []
- repeat with x = 1 to adjListLength
- add(adjacentList, getAt(the arrowList of gSimObject, readData(gSimObject)))
- end repeat
- end
-